function mstring = MultiString(hFigure, varargin)
% BVQXfigure::MultiString  - manipulate text of a listbox or dropdown
%
% FORMAT:       [subset] = MultiString(hControl [,pos [,setstr [,insert]]])
%
% Input fields:
%
%       hControl    BVQXfigure object of type listbox or dropdown
%       pos         numeric array that represents the index of the
%                   requested, replaced, or inserted rows
%       setstr      if given will either replace or insert strings,
%                   for single lines can be a char array, otherwise
%                   a cell array of chars
%       insert      if true inserts strings passed by setstr, otherwise
%                   replace strings
%
% Note: (1) if pos is missing, but setstr is given, setstr will be used to
%           either replace the GUI selected subset or, if insert is true,
%           inserted at the end of the control's string list
%       (2) if pos is given but no setstr is passed, MultiString returns
%           the subset of strings indexed by pos
%       (3) without any arguments, MultiString returns the GUI selected
%           entries, equivalent to MultiString(hControl, hControl.Value)
%       (4) if insert is true, pos gives the lines, where setstr entries
%           are inserted BEFORE, and -Inf and Inf marks the beginning and
%           end of the controls string list
%       (5) whenever a string is inserted, the first inserted entry will
%           be selected after the call is complete

% Version:      v0.7b
% Build:        7090119
% Date:         Sep-01 2007, 7:15 PM CEST
% Author:       Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL / Info:   http://wiki.brainvoyager.com/BVQXtools

% argument check
if numel(hFigure) ~= 1
    error( ...
        'BVQXfigure:InvalidObjectSize', ...
        'MultiString only works for singular objects.' ...
    );
end

% try retrieving/setting/inserting strings
try
    mstring = BVQXfigure(hFigure, 'MultiString', varargin{:});
catch
    rethrow(lasterror);
end
